otree pokracujeme. Budeme vytvarat kod vo visual studio otree appku. Toto je nas zaciatok, tak si to uloz, vcera sme to vytvorili spolocne. Mame 4 treatmenty v appke base, kde budu rozne verzie public goods game. takto sme nastavili rozhranie treatmentov a test. 1️⃣ settings.py
from os import environ
from os.path import dirname, join
import otree.settings

SESSION_CONFIGS = [
    {
        'name': 'no_judge',
        'display_name': 'No Judge',
        'num_demo_participants': 2,
        'app_sequence': ['base'],
        'treatment_type': 'no_judge',
    },
    {
        'name': 'human_judge',
        'display_name': 'Human Judge',
        'num_demo_participants': 2,
        'app_sequence': ['base'],
        'treatment_type': 'human_judge',
    },
    {
        'name': 'AI_judge',
        'display_name': 'AI Judge',
        'num_demo_participants': 2,
        'app_sequence': ['base'],
        'treatment_type': 'AI_judge',
    },
    {
        'name': 'humanAI_judge',
        'display_name': 'Human + AI Judge',
        'num_demo_participants': 2,
        'app_sequence': ['base'],
        'treatment_type': 'humanAI_judge',
    },
]

SESSION_CONFIG_DEFAULTS = {
    'real_world_currency_per_point': 1.0,
    'participation_fee': 0.00,
}

PARTICIPANT_FIELDS = []
SESSION_FIELDS = []

LANGUAGE_CODE = 'en'
REAL_WORLD_CURRENCY_CODE = 'USD'
USE_POINTS = True

OTREE_PRODUCTION = environ.get('OTREE_PRODUCTION') in {'1', 'true'}

INSTALLED_APPS = ['otree', 'base']

2️⃣ base/__init__.py
from otree.api import *

doc = """
Public Goods Game s rôznymi treatmentami.
"""

# ------------------------------
# KONSTANTY
# ------------------------------
class C(BaseConstants):
    NAME_IN_URL = 'base'
    PLAYERS_PER_GROUP = 2
    NUM_ROUNDS = 1


# ------------------------------
# MODELY
# ------------------------------
class Subsession(BaseSubsession):
    def creating_session(self):
        treatment_type = self.session.config.get('treatment_type')
        if treatment_type is None:
            raise ValueError("❌ treatment_type nie je nastavený v SESSION_CONFIG")
        self.session.vars.update({'treatment': treatment_type})
        print("DEBUG: creating_session called")
        print("DEBUG: session.config =", self.session.config)
        print("DEBUG: session.vars =", self.session.vars)


class Group(BaseGroup):
    pass


class Player(BasePlayer):
    pass


# ------------------------------
# PAGES
# ------------------------------
class Intro(Page):
    def vars_for_template(self):
        treat = self.session.config.get('treatment_type')
        return {'treat': treat}


class ResultsWaitPage(WaitPage):
    pass


class Results(Page):
    pass


# ------------------------------
# SEKVENCIA STRÁNOK
# ------------------------------
page_sequence = [Intro, ResultsWaitPage, Results]

3️⃣ base/templates/base/Intro.html
{% extends "global/Page.html" %}

{% block content %}
  <h1>Welcome to the Public Goods Game</h1>

  <p>Your treatment for this session is: <strong>{{ treat }}</strong></p>

  <form method="post">
    {% csrf_token %}
    <input type="submit" value="Next">
  </form>
{% endblock %}